package com.nt.train.service.factory;

import com.nt.train.service.Shape;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 简单工厂类，通过 Spring注解 @Autowired 和 @Service 实现
 * @author hlf
 * @version 1.0
 * @date 2022/8/5 18:22
 */
@Component // 添加Spring注解
public class ShapeBeanFactory {

    @Autowired
    private Map<String, Shape> shapeMap;

    public Shape getShape(String shapeType) {
        Shape bean1 = shapeMap.get(shapeType);
        System.out.println(bean1);
        return bean1;
    }

}